<script setup>
import {queryCategoryList} from '@/api/category'
import { onMounted,ref} from 'vue'
//加载树
const data =ref([])
const loadCategory=async()=>{
  let result =await queryCategoryList()
  console.log(result)
  data.value=result
}
const handleNodeClick=()=>{

}
//引入树组件
const defaultProps = {
  children: 'children',
  label: 'name',
}
//预加载
onMounted(()=>{
  loadCategory()
})
</script>
<template>
  <el-tree
    style="max-width: 600px"
    :data="data"
    :props="defaultProps"
    @node-click="handleNodeClick"
  />
</template>